%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Skin Nerve Data Analysis Software
% Ben Hoffman
% 08.04.16
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Summary plot for Response trace, raster, displacement and force
%
% 04.21.17
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [] = Summary_PlotV2( Output_R, Output_F, Output_D, Output_R_boolean, dataName, Cluster_Num )
figure;

subplot(1,1,4)
Amplitude = max(max(Output_R))-min(min(Output_R)); % Plot every response spread out
Maximum_Y = Amplitude*size(Output_R,2);
For_Plot_R = Convert_for_plot(Output_R, Amplitude);
ax_R = subplot(2,2,1); plot(For_Plot_R); ylim([(min(min(Output_R))) Maximum_Y]);
ax_R.XTick = [0 20000 40000 60000 80000 100000 120000 140000 160000 180000 200000];
ax_R.XTickLabel = {'0','1','2','3','4','5','6','7','8','9','10'};

For_Plot_D = Convert_for_plot(Output_D, 0.6); % Plot every displacement spread out
ax_D = subplot(2,2,2); plot(For_Plot_D);
ax_D.XTick = [0 20000 40000 60000 80000 100000 120000 140000 160000 180000 200000];
ax_D.XTickLabel = {'0','1','2','3','4','5','6','7','8','9','10'};

For_Plot_F = Convert_for_plot((Output_F*173), 173);
ax_F = subplot(2,2,4); plot(For_Plot_F);
ax_F.XTick = [0 20000 40000 60000 80000 100000 120000 140000 160000 180000 200000];
ax_F.XTickLabel = {'0','1','2','3','4','5','6','7','8','9','10'};

For_Plot_Raster = YF2_Make_Add_Value_For_Print(Output_R_boolean,1);
ax_Rast = subplot(2,2,3); plot(For_Plot_Raster);
ax_Rast.XTick = [0 20000 40000 60000 80000 100000 120000 140000 160000 180000 200000];
ax_Rast.XTickLabel = {'0','1','2','3','4','5','6','7','8','9','10'};

Cluster_Num_Str = num2str(Cluster_Num); % Convert Cluster number to string for title
suptitle([dataName ' CLUSTER: ' Cluster_Num_Str]);
end

